<template>
  <div class="manage-wrapper">
    <adminMemu></adminMemu>
    <div class="manage-contianer">
      <div class="manage-navs">
        <div v-for="(item,index) in navList" :key="index">{{item}}</div>
      </div>
      <div class="manage-content">
        <div class="content-item" v-for="(item,index) in factoryData" :key="index">
          <p>{{item.name}}</p>
          <p>{{item.address}}</p>
          <p>{{item.email}}</p>
          <p>{{item.phone}}</p>
          <p>{{item.leader}}</p>
          <p>{{item.mainCamp}}</p>
        </div>
      </div>
    </div>
    <div class="tip-popup" v-show="showPopup"></div>
    <div class="tip-contianer" v-show="showPopup">
      <p class="tip-title">提示</p>
      <div class="tip-content">
        <p>是否删除该工厂：<span style="color:#e60012">{{this.name}}</span></p>
      </div>
    </div>
  </div>
</template>

<script>
import adminService from '../../service/admin'
import adminMemu from '../admin/adminMemu'
export default {
  name: 'ManageFactory',
  components: {
    adminMemu
  },
  data () {
    return {
      navList: ['工厂名', '地址', '邮箱', '电话', '负责人', '主营'],
      factoryData: null,
      showPopup: false,
      name: ''
    }
  },
  async mounted () {
    let result = await adminService.getFactory()
    this.factoryData = result.data
  }
}
</script>

<style lang="scss" scoped>
.manage-wrapper {
  width: 100%;
  height: calc(100% - 1px);
  background: #FFFFFF;
  border-top: 1px solid transparent;
  .manage-contianer {
    width: 1200px;
    margin: 20px auto;
    border: 1px solid #ccc;
    .manage-navs {
      height: 40px;
      line-height: 40px;
      padding: 10px 20px;
      div {
        width: 150px;
        float: left;
        text-align: center;
      }
      div:nth-child(2) {
        width: 100px;
      }
      div:nth-child(4) {
        width: 200px;
      }
      div:nth-child(5) {
        width: 200px;
      }
    }
    .manage-content {
      width: 100%;
      overflow: hidden;
      .content-item {
        padding: 10px 20px;
        height: 40px;
        line-height: 40px;
        border-top: 1px solid #ccc;
        p {
          width: 150px;
          float: left;
          text-align: center;
        }
        p:nth-child(2) {
          width: 100px;
        }
        p:nth-child(4) {
          width: 200px;
        }
        p:nth-child(5) {
          width: 200px;
        }
        p:nth-child(7) {
          width: 100px;
          height: 25px;
          line-height: 25px;
          border: 1px solid #ccc;
          border-radius: 10px;
          cursor: pointer;
          margin: 7px 0;
        }
      }
    }
  }
  .tip-popup {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 998;
    background: #000;
    opacity: .3;
  }
  .tip-contianer {
    position: relative;
    padding: 10px;
    z-index: 999;
    margin: auto;
    width: 420px;
    padding-bottom: 10px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #ebeef5;
    font-size: 18px;
    box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
    .tip-title {
      padding: 5px 0;
      span:last-child {
        font-size: 18px;
        font-weight: bold;
      }
    }
    .tip-content {
      padding: 20px 10px;
    }
    .tip-button {
      height: 30px;
      line-height: 30px;
      display: flex;
      justify-content: flex-end;
      p {
        margin-left: 20px;
        border: 1px solid #ccc;
        padding: 0 15px;
        border-radius: 5px;
        cursor: pointer;
      }
      p:last-child {
        background: #569cf4;
        color: #fff;
      }
    }
  }
}
</style>
